import Vue from 'vue'
import Router from 'vue-router'

const VueRouterPush = Router.prototype.push
Router.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

Vue.use(Router)

// 路由列表
const routes =  [
  {
      path: '/',
      redirect: '/merchant'
  },
  {
    path: '/merchant',
    name: 'merchant',
    component: () => import('@/views/index.vue'),
    meta: { title: '国付银', nav: false, deep: 1 }
}
]

export const router = new Router({
  mode: 'hash',
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
        return savedPosition
    } else {
        return { top: 0 }
    }
  }
})